package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaCilent;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: xrl
 * @Date: 2022/10/21  19:23
 * @Version 1.0
 * 敏感词
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {

    @Autowired
    private IWemediaCilent wemediaCilent;
    /**
     * 查询列表
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return wemediaCilent.list(dto);
    }

    /**
     * 删除敏感词
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delSensitive(@PathVariable("id") Integer id) {
        return wemediaCilent.delSensitive(id);
    }

    /**
     * 添加敏感词
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        return wemediaCilent.saveSensitive(wmSensitive);
    }

    /**
     * 修改敏感词
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return wemediaCilent.updateSensitive(wmSensitive);
    }
}
